<template>
  <div>
    <header-nav></header-nav>
    <div
      class="user"
      v-for="(item, index) in videos"
      :key="index"
      @click="imgu(item.r.id)"
    >
      <div class="user-img">
        <img :src="item.r.a.p" alt="" />
        <div class="name">{{ item.r.a.n }}</div>
        <div class="lv">LV.{{ item.r.a.lv }}</div>
      </div>
      <div class="food-img">
        <video :src="item.r.vfurl" controls="controls"></video>
      </div>
      <div class="Collection">
        <div class="Collection-all">
          <div
            class="Collection-img"
            v-for="value in item.r.collect_users"
            :key="value.id"
          >
            <img :src="value.p" alt="" />
          </div>
          <div class="Collection-person">
            {{ item.r.collect_count_text }}
          </div>
        </div>
        <div class="iconfont icon-shoucangjia"></div>
      </div>
      <div class="food-name">
        <p>{{ item.r.n }}</p>
      </div>
    </div>
  </div>
</template>

<script>
import headerNav from "../components/base/headerNav.vue";

import { getHomeVideo } from "../api/video";
export default {
  data() {
    return {
      videos: [],
    };
  },
  methods: {
    imgu(id) {
    
      this.$router.push({ path: "/details", query: { id: id } });
    },
  },
  created() {
    getHomeVideo().then((data) => {
      this.videos = data.result.list;
      console.log(this.videos);
    });
  },
  components: {
    headerNav,
  },
};
</script>

<style lang="less">
.user {
  width: 100%;
  margin-bottom: 30px;
  .user-img {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    img {
      width: 32px;
      height: 32px;
      margin-left: 13px;
      border-radius: 50%;
    }
    .name {
      margin-left: 7px;
      font-size: 12px;
      line-height: 12px;
      color: #2a2a2a;
    }
    .lv {
      margin-left: 7px;
      font-size: 8px;
      line-height: 8px;
      color: #cba43b;
    }
  }
  .food-img {
    width: 100%;
    margin-bottom: 15px;

    img {
      width: 100%;
      height: 100%;
    }
    video {
      width: 100%;
      height: 100%;
    }
    p {
      position: absolute;
      bottom: 10px;
      left: 13px;
      display: flex;
      justify-content: space-around;
      align-items: center;
      color: white;
      font-size: 12px;
      line-height: 12px;
      span {
        display: block;
        margin-left: 195px;
      }
    }
  }
  .Collection {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    .Collection-all {
      display: flex;
      margin-left: 13px;
      .Collection-img {
        width: 15px;
        height: 15px;
        img {
          width: 100%;
          border-radius: 50%;
        }
      }
      .Collection-person {
        margin-left: 10px;
        font-size: 10px;
        line-height: 10px;
        color: #0d0d0d;
      }
    }
    .iconfont {
      margin-right: 12px;
      font-size: 20px;
      line-height: 20px;
      color: #000000;
    }
  }
  .food-name {
    font-size: 14px;
    line-height: 18px;
    color: #292929;
    margin: 0px 13px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
}
</style>